// 定义路由表
import React, { Suspense } from 'react'
// 引入组件
const Home = React.lazy(() => import('../pages/Home'))
const Login = React.lazy(() => import('../pages/Login'))
const Test1 = React.lazy(() => import('../pages/Test1'))
const Test2 = React.lazy(() => import('../pages/Test2'))
function load(Son) {
  return (
    <Suspense
      fallback={
        <div style={{ color: 'red', fontSize: 60 }}>正在加载,请稍等...</div>
      }
    >
      <Son></Son>
    </Suspense>
  )
}
export default [
  {
    path: '',
    element: load(Home),
  },
  {
    path: 'home',
    element: load(Home),
    children: [
      {
        path: 'test1',
        element: load(Test1),
      },
      {
        path: 'test2',
        element: load(Test2),
      },
    ],
  },
  {
    path: 'login',
    children: [
      {
        path: '',
        element: load(Login),
      },
      {
        path: ':xxx',
        children: [
          {
            path: ':yyy',
            element: load(Login),
          },
          {
            path: '',
            element: load(Login),
          },
        ],
      },
    ],
  },
]
